package com.qboot.rabbitmq.simple;

import lombok.RequiredArgsConstructor;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 简单模型 Simple - 生产者
 *
 * @author Tellsea
 * @date 2023/3/7
 */
@Component
@RequiredArgsConstructor(onConstructor_ = @Autowired)
public class SimpleProducer {

    private final RabbitTemplate rabbitTemplate;

    public void send(String message) {
        rabbitTemplate.convertAndSend(SimpleConst.QUEUE_NAME, message);
        System.out.println("SimpleProducer 发送消息：" + message);
    }
}
